package edu.ycxy.poetry.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.ycxy.poetry.entity.User;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * @Author @xin
 * @createDate 2022/4/26
 * @Description 用户信息数据操作类
 */
@Repository
public interface UserMapper extends BaseMapper<User> {

    // 根据邮箱查询用户表中的信息
    @Select("select * from vab_user where email=#{email}")
    User findByEmail(String email);

    //更新信息
    @Update("update vab_user set email=#{email},password=#{password},nickname=#{nickname},username=#{username},address=#{address},city=#{city},country=#{country},zipCode=#{zipCode},aboutMe=#{aboutMe} where id=#{id}")
    Integer update(User user);

    @Select("select * from vab_user where id=1")
    User findInfo();
}
